**************************
*Description of the data*
**************************

*description of the predicted outcome
bysort country: list position_pr_2 party, sepby(country)
table position_pr_2

*construction of the CMP aggregated indicators
generate log_minority = log(per701+per703+per704+per705+per706+0.5)-log(per702+per305+0.5)
generate log_rile_eco = log(per401+per402+per407+per414+per505+0.5)-log(per403+per404+per406+per412+per413+per504+per506+0.5)

*construction of the seat share variable
generate seat_share=absseat/totseats

*description of the raw predictive variables
summarize log_minority log_rile_eco right_family left_family seat_share

*standardization of the predictive variables
generate log_rile_eco_stand=(log_rile_eco+0.9198665) / 1.168096
generate log_minority_stand= (log_minority-1.112429) / 1.396397
generate seat_share_stand= (seat_share-0.1837935) / 0.1814107


*description of the standardized variables
summarize log_minority_stand seat_share_stand log_rile_eco_stand

*creation of an outlier variable

gen outlier=0
replace outlier=1 if party=="Lista Panella"

*description of the standardized variable without outlier
summarize log_minority_stand if outlier==0

generate log_minority_stand_outlier=(log_minority_stand-0.035551) / 0.9285572
summarize log_minority_stand_outlier if outlier==0

*inversion of seat share
gen seat_share_stand_inv=-(seat_share_stand)

**********
*Analyses*
**********

xtset country_num

*social groups, all cases
xtlogit position_pr_2 log_minority_stand, fe
xtlogit position_pr_2 log_minority_stand officet0 per301, fe

*social groups, without outlier
xtlogit position_pr_2 log_minority_stand_outlier if outlier==0, fe
xtlogit position_pr_2 log_minority_stand_outlier officet0 per301 if outlier==0, fe

*ideology (family)
xtlogit position_pr_2 right_family left_family, fe
xtlogit position_pr_2 right_family left_family officet0 per301, fe


*ideology (scale)
xtlogit position_pr_2 log_rile_eco_stand, fe
xtlogit position_pr_2 log_rile_eco_stand officet0 per301, fe


*seat share
xtlogit position_pr_2 seat_share_stand_inv, fe
xtlogit position_pr_2 seat_share_stand_inv officet0 per301, fe

*confronting*
xtlogit position_pr_2 seat_share_stand_inv log_minority_stand, fe
xtlogit position_pr_2 seat_share_stand_inv log_minority_stand officet0 per301, fe

xtlogit position_pr_2 seat_share_stand_inv log_minority_stand_outlier if outlier==0, fe
xtlogit position_pr_2 seat_share_stand_inv log_minority_stand_outlier officet0 per301 if outlier==0, fe

xtlogit position_pr_2 seat_share_stand_inv right_family left_family, fe
xtlogit position_pr_2 seat_share_stand_inv right_family left_family officet0 per301, fe

xtlogit position_pr_2 seat_share_stand log_rile_eco_stand, fe
xtlogit position_pr_2 seat_share_stand log_rile_eco_stand officet0 per301, fe
